package com.springboot.astra.service.serviceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.astra.bean.Carousel;
import com.springboot.astra.bean.Goods;
import com.springboot.astra.bean.Tag;
import com.springboot.astra.mapper.GoodsMapper;
import com.springboot.astra.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Autowired
    GoodsMapper goodsMapper;

    @Override
    public Goods getOneById(Integer id) {
        return goodsMapper.getOneById(id);
    }

    @Override
    public List<Goods> getAll() {
        return goodsMapper.getAll();
    }

    @Override
    public List<Tag> getTags(Integer goodsId) {
        return goodsMapper.getTags(goodsId);
    }

    @Override
    public List<Carousel> getCarousels(Integer goodsId) {
        return goodsMapper.getCarousels(goodsId);
    }

    @Override
    public IPage<Goods> pageGoodsVo(Page<Goods> page, String query) {
        return goodsMapper.pageGoodsVo(page,query);
    }

    @Override
    public IPage<Goods> pageGoodsVoForUser(Page<Goods> page, String query) {
        return goodsMapper.pageGoodsVoForUser(page,query);
    }

    @Override
    public void insertGoods(Goods goods) {
        goodsMapper.insertGoods(goods);
    }

    @Override
    public void updateOneById(Goods goods) {
        goodsMapper.updateOneById(goods);
    }

    @Override
    public void deleteOneById(Goods goods) {
        goodsMapper.deleteOneById(goods);
    }
}
